import request from './utils/requset'
import hasPermission from './utils/hasPermission';
import utilConfig from './utils/config';
App({
  onLaunch() {
    const PageFn = Page
    Page = function(config){
      config.$request = request

      const showFn = config.onShow;
      
      config.onShow = function(){
        const result = utilConfig.checkPermission[this.route];
        if(result){
          const flag = hasPermission()
          if(!flag)return
        }
        showFn&&showFn.call(this);
      }
      return PageFn(config);
    }
  },
  globalData: {
    userInfo: null
  }
})
